from goby.goby import Goby
from httpx.httpx import HTTPX
from config.settings import HTTPX_EXEC_PATH
from rapiddns.rapiddns import RapidDnsScan
from awvs.awvs import AWVS


def workflow_domain_ip(domains: list, save_path):
    awvs = AWVS()
    goby = Goby()
    for domain in domains:
        rapid = RapidDnsScan(domain)
        rapid.run(save_path)
        subdomains = list(rapid.subdomains)
        ips = rapid.A
        print('存活性检测...')
        httpx = HTTPX(HTTPX_EXEC_PATH, subdomains)
        httpx.run(save_path)
        print('awvs检测')
        awvs.run(httpx.results, save_path=save_path)
        print('Goby检测')
        goby.run(ips, save_path=save_path)
        # print('zoomeye检测')
        # zoom = Zoomeye(ips)
        # zoom.run(save_path)
        # print('shodan检测')
        # shodan = Shodan(ips)
        # shodan.run(save_path)
        print('运行结束')





if __name__ == '__main__':
    domain_example = input('>> 请输入域名(示意: example.com): ')
    save_path = f'res/{domain_example}.xlsx'
    workflow_domain_ip([domain_example], save_path=save_path)
